home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Samples / C++ / Direct3D / StateManager / LoadSceneFromX.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-27  |  2.8 KB  |  71 lines

  1. //--------------------------------------------------------------------------------------
  2. // File: LoadSceneFromX.h
  3. //
  4. // Enables the sample to build a scene from an x-file ('scene.x').
  5. // The x-file has been extended to include custom templates for specifying mesh filenames
  6. // and camera objects within frames.
  7. //
  8. // Copyright (c) Microsoft Corporation. All rights reserved.
  9. //--------------------------------------------------------------------------------------
  10.  
  11. #pragma once
  12.  
  13. //--------------------------------------------------------------------------------------
  14. // STL dependancy
  15. //--------------------------------------------------------------------------------------
  16. #pragma warning ( push )
  17. #pragma warning ( disable : 4702 ) // unreachable code
  18. #include <vector>
  19. #pragma warning ( pop )
  20. using std::vector;
  21.  
  22.  
  23. //--------------------------------------------------------------------------------------
  24. // Contains a reference to a mesh file.
  25. // Multiple meshes may exist within a given frame.
  26. //--------------------------------------------------------------------------------------
  27. typedef struct _MESH_REFERENCE
  28. {
  29.     DWORD dwRenderPass;
  30.     CHAR szFileName[MAX_PATH];
  31.     _MESH_REFERENCE(DWORD _dwRenderPass, LPCSTR pszFileName )
  32.     {
  33.         dwRenderPass = _dwRenderPass;
  34.         strncpy( szFileName, pszFileName, MAX_PATH );
  35.         szFileName[MAX_PATH-1] = 0;
  36.     }
  37. } MESH_REFERENCE;
  38.  
  39.  
  40. //--------------------------------------------------------------------------------------
  41. // Contains a reference to a camera object
  42. //--------------------------------------------------------------------------------------
  43. typedef struct _CAMERA_REFERENCE
  44. {
  45.    FLOAT fRotationScaler;   // Camera rotation speed
  46.    FLOAT fMoveScaler;       // Camera translation speed
  47.    _CAMERA_REFERENCE( FLOAT _fRotationScaler, FLOAT _fMoveScaler )
  48.    {
  49.         fRotationScaler = _fRotationScaler;
  50.         fMoveScaler = _fMoveScaler;
  51.    }
  52. } CAMERA_REFERENCE;
  53.  
  54.  
  55. //--------------------------------------------------------------------------------------
  56. // Contains a node for a frame within the hierarchy.
  57. //--------------------------------------------------------------------------------------
  58. typedef struct _FRAMENODE
  59. {
  60.     D3DXMATRIX mat;                     // Holds the collapsed matrix value for the frame
  61.     vector<MESH_REFERENCE>   meshes;    // Each Frame may contain multiple meshes
  62.     vector<CAMERA_REFERENCE> cameras;   // Each Frame may contain multiple cameras
  63. } FRAMENODE;
  64.  
  65.  
  66.  
  67. //--------------------------------------------------------------------------------------
  68. // Reads the scene x-file, and adds the collapsed frame hierarchy to the vecFrameNodes Hierarchy.
  69. //--------------------------------------------------------------------------------------
  70. HRESULT LoadSceneFromX( vector<FRAMENODE>& vecFrameNodes, LPWSTR wszFileName );
  71.